package com.baizhi.luoht.util;/**
 * @Author:luoht
 * @Description：
 * @Date：Create in 10:09 2018/10/24
 */

import org.springframework.core.convert.converter.Converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @program: SpringMVC
 * @description:
 * @author: luoht
 * @create: 2018-10-24 10:09
 **/

public class DateConvertUtil implements Converter<String,Date>{

    @Override
    public Date convert(String s) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        try {
            Date parse = dateFormat.parse(s);
            return parse;
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
}
